<template>
  <div class="newspaper-subcribe">
    <div class="main">
      <div class="title">出入境申请信息</div>
      <div class="row">
        <span class="field-name">出生地</span>
        <span class="field-value"
          ><input type="text" placeholder="请输入出生地" v-model="form.csd"
        /></span>
      </div>
      <div class="row">
        <span class="field-name">户口所在地</span>
        <span class="field-value"
          ><input
            type="text"
            placeholder="请输入户口所在地"
            v-model="form.hkszd"
        /></span>
      </div>
      <div class="row vanRadioItem">
        <span class="field-value">
          <van-radio-group v-model="form.sqqzzl" direction="horizontal">
            <span class="field-name">申请签证种类</span>
            <van-radio v-for="(item, index) in sqqzzl" :key="index" :name="item.val">{{item.name}}</van-radio>
          </van-radio-group>
        </span>
      </div>
      <div class="row vanRadioItem" v-show="type != 2">
        <span class="field-value">
          <van-radio-group v-model="form.qzlx" direction="horizontal">
            <span class="field-name">签注类型</span>
            <van-radio v-for="(item, index) in qzlx" :key="index" :name="item.val">{{item.name}}</van-radio>
          </van-radio-group>
        </span>
      </div>
      <div class="row vanRadioItem" v-show="type == 3 || type == 4">
        <span class="field-value">
          <van-radio-group v-model="form.qzls" direction="horizontal">
            <span class="field-name">签注历史</span>
            <!-- <van-radio v-for="(item, index) in qzls" :key="index" :name="item.val">{{item.name}}</van-radio> -->
            <van-radio :name="'1'">3个月一次</van-radio>
            <van-radio v-show="form.qzlx === '1' || form.qzlx === '2' || form.qzlx === '4'" :name="'2'">3个月二次</van-radio>
            <van-radio v-show="form.qzlx === '3' || form.qzlx === '4'" :name="'3'">3个月多次</van-radio>
          </van-radio-group>
        </span>
      </div>
    </div>
    <button class="send-btn" @click="submit">提交</button>
  </div>
</template>

<script>
import {syscodecontrollerGetqzlx, syscodecontrollerGetqzls, syscodecontrollerGetsqqzzl, yscgjSavedate1} from '@/assets/js/api';
export default {
  data() {
    return {
      show: false,
      form: {
        csd: '',
        hkszd: '',
        qzlx: '',
        qzls: '',
        sqqzzl: ''
      },
      list: [],
      sqqzzl: [],
      qzls: [],
      qzlx: [],
      isBm: 0,
      type: 0,
      dspToken: localStorage.dspToken
    };
  },
  components: {},
  mounted() {
    // {1代表是国外时（非港澳台），护照有效、
    // 2代表是国外时（非港澳台），护照无效、
    // 3代表是香港或澳门时  ， 护照有效、
    // 4代表是香港或澳门时     通行证无效、
    // 5代表是台湾时    ，  护照有效、
    // 6代表是台湾时    ，  通行证无效、}

    this.type = this.$route.query.id;

    syscodecontrollerGetsqqzzl().then(res => {
      this.sqqzzl = res.data;
    });
    syscodecontrollerGetqzls().then(res => {
      this.qzls = res.data;
    });
    syscodecontrollerGetqzlx().then(res => {
      this.qzlx = res.data;
    });
  },
  methods: {
    submit() {
      // if (!this.form.newspaper) {
      //   return this.$toast('请填写报纸名称');
      // }
      // if (!this.form.address) {
      //   return this.$toast('请填写住址信息');
      // }
      // if (!this.form.postCode) {
      //   return this.$toast('请填写邮编');
      // }
      // if (!this.form.mobile) {
      //   return this.$toast('请填写手机号');
      // }
      yscgjSavedate1({
        ...this.form,
        dspToken: this.dspToken
      }).then(({pkValue}) => {
        let yscgjSavedataJson = JSON.parse(sessionStorage.yscgjSavedataJson);
        yscgjSavedataJson.djxxId = pkValue;
        sessionStorage.yscgjSavedataJson = JSON.stringify(yscgjSavedataJson);
        this.$toast('出入境申请成功！');
        sessionStorage.AbroadApply = 1;
        history.go(-1);
      });
    }
  }
};
</script>

<style lang="less" scoped>
.newspaper-subcribe {
  min-height: 100%;
  box-sizing: border-box;
  background: #f5f5f5;
  padding: 22px;
  .main {
    background-color: #ffffff;
    box-shadow: 3px 4px 9px 1px rgba(1, 88, 155, 0.05);
    border-radius: 8px;
    .title {
      height: 64px;
      background-color: #3198ed;
      color: #ffffff;
      font-size: 30px;
      line-height: 64px;
      padding: 0 16px;
      border-top-left-radius: 8px;
      border-top-right-radius: 8px;
    }
    .row {
      display: flex;
      height: 114px;
      padding: 0 40px;
      align-items: center;
      justify-content: space-between;
      /deep/ .van-radio-group {
        line-height: 1.5;
        .van-radio {
          padding-left: 4px;
          padding-bottom: 35px;
          .van-radio__icon {
            font-size: inherit;
          }
          .van-radio__label {
            height: auto;
            line-height: inherit;
          }
        }
      }
      .content {
        padding-bottom: 10px;
      }
      &:not(:last-child) {
        border-bottom: 1px solid #eee;
      }
      .field-name {
        min-width: 140px;
        font-size: 34px;
        color: #888;
      }
      .field-value {
        font-size: 34px;
        letter-spacing: 0px;
        color: #353535;
        > input {
          width: 100%;
          height: 100%;
          text-align: right;
        }
      }
      .arrow {
        display: flex;
        justify-content: flex-end;
        align-items: center;
        font-size: 34px;
        color: #888;
        text-align: right;
      }
    }
    .vanRadioItem {
      height: auto;
      padding: 40px 40px 0 40px;
    }
  }
  .send-btn {
    width: 100%;
    border: none;
    height: 90px;
    line-height: 90px;
    margin-top: 29px;
    text-align: center;
    background-color: #3198ed;
    box-shadow: 0px 5px 5px 0px rgba(89, 166, 250, 0.1);
    border-radius: 45px;
    font-size: 36px;
    letter-spacing: 7px;
    color: #fff;
  }
  .historylist {
    .historytitle {
      color: #888888;
      font-size: 30px;
      margin: 19px 0;
    }
    .item {
      width: 704px;
      // height: 140px;
      background-color: #ffffff;
      box-shadow: 3px 4px 9px 1px rgba(1, 88, 155, 0.05);
      border-radius: 8px;
      margin: 0 auto;
      margin-top: 23px;
      position: relative;
      padding: 31px 30px 26px 33px;
      box-sizing: border-box;
      display: flex;
      &::before {
        content: "";
        width: 5px;
        // height: 140px;
        background-color: #3198ed;
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        border-top-left-radius: 50px;
        border-bottom-left-radius: 50px;
      }
      > div:first-child {
        flex: 1;
        p:first-child {
          color: #888888;
          font-size: 30px;
        }
        p:last-child {
          width: calc(100vw - 160px);
          color: #353535;
          font-size: 34px;
          // white-space: nowrap;
          // text-overflow: ellipsis;
          // overflow: hidden;
        }
      }
      > div:last-child {
        width: 50px;
        font-size: 34px;
        color: #b2b2b2;
        align-self: center;
        text-align: right;
      }
    }
  }
}
</style>
